﻿using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;

/// <summary>
/// Summary description for XL_PhatSinhMaMoi
/// </summary>
public class XL_PhatSinhMaMoi
{
    public XL_PhatSinhMaMoi()
    {
        //
        // TODO: Add constructor logic here
        //
    }
    static public void Them_0(ref string s, int n)
    {
        while (s.Length < n)
            s = "0" + s;
    }
    static public string TaoMaMoi(string s, int nKytu)
    {

        int pos = s.Length - nKytu;
        // Tach phan chu va phan so

        string phanChu = s.Substring(0, nKytu);
        string phanSo = s.Substring(nKytu, pos);

        int so = Convert.ToInt32(phanSo);
        so++;
        phanSo = so.ToString();
        Them_0(ref phanSo, pos);

        string Mamoi = phanChu + phanSo;
        return Mamoi;
    }
}
